﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddCaterer.aspx.cs" Inherits="WebApplication1.AddCater" MasterPageFile="~/masterpage/User.Master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">


    <%--Begin Loading ajax section--%>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
                <div class="center">

                    <img alt="" src="images/loading.gif" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <%--End Loading ajax section--%>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="container-fluid">

                <fieldset>
                    <legend>Add Cafe</legend>
                </fieldset>
                <!-- Alert Message -->
                <asp:Panel ID="divMessage" runat="server" Visible="False" role="alert">
                    <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <asp:Label ID="lblMessage" runat="server" Text="">
                         
                    </asp:Label>
                </asp:Panel>
                <div class="control-group col-md-8">

                    <label class="control-label">Cafe Name:</label>
                    <div class="controls">
                        <asp:TextBox ID="txtName" runat="server" class="form-control" MaxLength="199" ToolTip="Cafe name (max length 199 characters)"></asp:TextBox>
                    </div>

                    <label class="control-label">Cafe Email:</label>
                    <div class="controls">
                        <asp:TextBox ID="txtEmail" runat="server" class="form-control" MaxLength="199" ToolTip="Cafe email (max length 199 characters)"></asp:TextBox>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Phone:</label>
                        <div class="controls">
                            <%--<%# Eval("fos_Site.sitename") %>--%>
                            <asp:TextBox ID="txtPhone" runat="server" class="form-control" ToolTip="Phone Number" MaxLength="30"></asp:TextBox>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Password:</label>
                        <div class="controls">
                            <asp:TextBox runat="server" type="Password" ID="txtPassword" name="password" class="form-control" MaxLength="30" ToolTip="Login password"></asp:TextBox>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Retype Password:</label>
                        <div class="controls">
                            <asp:TextBox runat="server" type="Password" ID="txtRetypePassword" name="password2" class="form-control" MaxLength="30" Text="Retype login password"></asp:TextBox>
                        </div>
                    </div>
                    <label class="control-label">Caterer Site:</label>

                    <div class="controls">
                        <asp:DropDownList ID="dropdownSite" runat="server" class="form-control"></asp:DropDownList>
                    </div>

                    <label class="control-label">Printer:</label>
                    <div class="controls">
                        <asp:DropDownList ID="dropdownPrinter" runat="server" class="form-control" DataSourceID="OdsPrinter" DataTextField="nameNstatus" DataValueField="id"></asp:DropDownList>
                    </div>
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls">

                            <asp:Button ID="btnSubmit" runat="server" class="btn  btn-primary" Text="Add" OnClick="btnSubmit_Click" />
                        </div>
                    </div>

                </div>
                <br />
                <div class="control-group col-md-8">
                    <fieldset>
                        <legend>Cafe List</legend>

                    </fieldset>

                    <asp:ListView ID="listviewCaterer" runat="server" DataSourceID="odsCaterer" OnDataBinding="listviewCaterer_DataBinding" DataKeyNames="id" OnItemDataBound="listviewCaterer_ItemDataBound">
                        <EditItemTemplate>
                            <tr style="">
                                <td>
                                    <asp:Label ID="IdLabel" runat="server" Text='<%# Bind("Id") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                </td>
                                <td>
                                    <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' MaxLength="30" ToolTip="Phone number" />
                                </td>
                                <td>
                                    <asp:Label ID="EmailLabel" runat="server" Text='<%# Bind("Email") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Eval("CreatedDate") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedByLabel" runat="server" Text='<%# Eval("CreatedBy") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="LastModifiedDateLabel" runat="server" Text='<%# Bind("LastModifiedDate") %>' />
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataTextField="name" DataValueField="id" AppendDataBoundItems="True" DataSourceID="ObjectDataSource1"></asp:DropDownList>
                                    <asp:Label ID="lblSite" runat="server" Text='<%# CheckSite(Eval("fos_UserLinkSite")) %>' Visible="false" />
                                </td>
                                <td>

                                    <asp:DropDownList ID="DropDownList2" runat="server" DataTextField="name" DataValueField="id" AppendDataBoundItems="True" DataSourceID="OdsPrinter"></asp:DropDownList>
                                    <asp:Label ID="lblExPrinter" runat="server" Text='<%# CheckPrinter(Eval("fos_SiteLinkPrinter")) %>' Visible="false" />
                                </td>
                                <td>
                                    <asp:Button ID="UpdateButton" runat="server" class="btn btn-primary" CommandName="Update" Text="Update" />
                                    <asp:Button ID="CancelButton" runat="server" class="btn btn-primary" CommandName="Cancel" Text="Cancel" />
                                </td>
                            </tr>
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            <table runat="server" style="">
                                <tr>
                                    <td>No data was returned.</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <tr style="">
                                <td>
                                    <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
                                </td>
                                <%--                    <td>
                        <asp:Label ID="PasswordLabel" runat="server" Text='<%# Eval("Password") %>' />
                    </td>--%>
                                <td>
                                    <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Eval("CreatedDate") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedByLabel" runat="server" Text='<%# Eval("CreatedBy") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="LastModifiedDateLabel" runat="server" Text='<%# Eval("LastModifiedDate") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="lblSite1" runat="server" Text='<%# CheckSite(Eval("fos_UserLinkSite")) %>' Visible="true" />
<%--                                    <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# RemoveIsDeleted(Eval("fos_UserLinkSite")) %>'>
                                        <HeaderTemplate>
                                            <ul>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <li>'<%# Eval("fos_Site.sitename") %>' </li>
                                        </ItemTemplate>

                                        <FooterTemplate></ul></FooterTemplate>

                                    </asp:Repeater>--%>
                                </td>
                                <td>
                                    <asp:Label ID="lblExPrinter1" runat="server" Text='<%# CheckPrinter(Eval("fos_SiteLinkPrinter")) %>' Visible="true" />
                                </td>
                                <td>
                                    <asp:Button ID="DeleteButton" runat="server" class="btn btn-primary" CommandName="Delete" Text="Delete" />
                                    <asp:Button ID="EditButton" runat="server" class="btn btn-primary" CommandName="Edit" Text="Edit" />
                                </td>
                            </tr>
                        </ItemTemplate>
                        <LayoutTemplate>

                                        <table id="itemPlaceholderContainer" runat="server" border="0" style="" class="table table-hover table-bordered">
                                            <tr runat="server" style="" class="info">
                                                <th runat="server">Id</th>
                                                <th runat="server">Name</th>
                                                <th runat="server">Phone</th>
                                                <th runat="server">Email</th>
                                                <th runat="server">Created Date</th>
                                                <th runat="server">Created By</th>
                                                <th runat="server">Last Modified Date</th>
                                                <th runat="server">Site</th>
                                                <th runat="server">Printer</th>
                                                <th runat="server">Action</th>
                                            </tr>
                                            <tr id="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                        </LayoutTemplate>
                        <SelectedItemTemplate>
                            <tr style="">
                                <td>
                                    <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="WWIDLabel" runat="server" Text='<%# Eval("WWID") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="PasswordLabel" runat="server" Text='<%# Eval("Password") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Eval("CreatedDate") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="CreatedByLabel" runat="server" Text='<%# Eval("CreatedBy") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="LastModifiedDateLabel" runat="server" Text='<%# Eval("LastModifiedDate") %>' />
                                </td>
                                <td>

                                    <%--  <asp:Label ID="fos_UserLinkSiteLabel" runat="server" Text='<%# Eval("fos_UserLinkSite") %>' />--%>
                                </td>
                            </tr>
                        </SelectedItemTemplate>
                    </asp:ListView>
                    
                <asp:DataPager ID="dp" runat="server" PagedControlID="listviewCaterer" ClientIDMode="AutoID">
                    <Fields>
                        <asp:NumericPagerField />

                    </Fields>
                </asp:DataPager>
                    <asp:ObjectDataSource ID="odsCaterer" runat="server" SelectMethod="GetUsersByRole" TypeName="Business.UserManagement" OnUpdating="odsCaterer_Updating" UpdateMethod="UpdateUserProperty" OnDataBinding="odsCaterer_DataBinding" DeleteMethod="DeleteUser" OnDeleting="odsCaterer_Deleting" OnDeleted="odsCaterer_Deleted" OnUpdated="odsCaterer_Updated">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="3" Name="roleid" Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="id" Type="String" />
                            <asp:Parameter Name="phone" Type="String" />
                            <asp:Parameter Name="email" Type="String" />
                            <asp:Parameter Name="lastModifiedDate" Type="String" />
                            <asp:Parameter Name="lastModifiedBy" Type="String" />
                            <asp:Parameter Name="roleid" Type="String" />
                            <asp:Parameter Name="siteid" Type="String" />
                        </UpdateParameters>
                        <DeleteParameters>
                            <asp:Parameter Name="id" Type="String" />
                        </DeleteParameters>
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllSite" TypeName="Business.SiteManagement"></asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="OdsPrinter" runat="server" SelectMethod="GetAllPrinter" TypeName="Business.PrinterManagement"></asp:ObjectDataSource>
                </div>
                <div class="control-group col-md-4"></div>

            </div>

        </ContentTemplate>
    </asp:UpdatePanel>

</asp:Content>

